***********************************************
***** Pandora's Rules in the Laboratory  ******
***********************************************

** Run this file to replicate results shown in Tables A5, A6, A7, A8, A9 in Appendix. 
** After executing the commands below, the findings were manually transferred into the relevant Tables. ** In some cases, after executing the ''preserve' and ''collapse'' commands,  we mannualy transfered the data into the relevant Tables before executing the "''restore'' command.
** Input file: Additional Treatments.dta


** Change working directory
cd "..."
use "Additional.dta", clear


** Table A5
** Full Periods
preserve 
collapse Payoff, by(treatment) 
replace  Payoff = Payoff*100
restore

** Half periods
preserve 
collapse Payoff if Period>50, by(treatment) 
replace Payoff = Payoff*50
restore


*Table A6
** Full periods
preserve 
collapse Payoff, by(treatment Subject)
gen Payoff0 = Payoff if treatment == 0
gen Payoff1 = Payoff if treatment == 1
gen Payoff2 = Payoff if treatment == 2
gen Payoff3 = Payoff if treatment == 3
ttest Payoff0 = Payoff2, unpaired
ttest Payoff1 = Payoff3, unpaired
ranksum Payoff if treatment == 0 | treatment == 2, by(treatment)
ranksum Payoff if treatment == 1 | treatment == 3, by(treatment)
restore

** Half periods
preserve 
keep if Period>50
collapse Payoff, by(treatment Subject)
gen Payoff0 = Payoff if treatment == 0
gen Payoff1 = Payoff if treatment == 1
gen Payoff2 = Payoff if treatment == 2
gen Payoff3 = Payoff if treatment == 3
ttest Payoff0 = Payoff2, unpaired
ttest Payoff1 = Payoff3, unpaired
ranksum Payoff if treatment == 0 | treatment == 2, by(treatment)
ranksum Payoff if treatment == 1 | treatment == 3, by(treatment)
restore



*Table A7
quietly regress Payoff Treat i.Period , vce(cluster ID2)
estimates store m6
quietly regress Payoff Treat pos2 i.Period, vce(cluster ID2)
estimates store m7
outreg2 [m6] using tableA7.tex, replace ctitle(1)   keep(Payoff Treat pos2)    tdec(4) bdec(4)
outreg2 [m7] using tableA7.tex, append  ctitle(2)   keep(Payoff Treat pos2)    tdec(4) bdec(4)


*Table A8
quietly regress correct Period if treatment==0, vce(cluster ID2)
estimates store m1
quietly regress correct Period if treatment==1, vce(cluster ID2)
estimates store m2
quietly regress correct Period if treatment==2, vce(cluster ID2)
estimates store m3
quietly regress correct Period if treatment==3, vce(cluster ID2)
estimates store m4

outreg2 [m1]  using tableA8.tex, replace ctitle(1)   keep(correct Period)   tdec(4) bdec(4)
outreg2 [m2]  using tableA8.tex, append  ctitle(2)   keep(correct Period)   tdec(4) bdec(4)
outreg2 [m3]  using tableA8.tex, append  ctitle(3)   keep(correct Period)   tdec(4) bdec(4)
outreg2 [m4]  using tableA8.tex, append  ctitle(4)   keep(correct Period)   tdec(4) bdec(4)


** Table A9
gen     treatment50 = 0 if treatment==0 
replace treatment50 = 1 if treatment==2

gen     treatment90 = 0 if treatment==1 
replace treatment90 = 1 if treatment==3

quietly probit openfirst treatment50  i.Period , vce(cluster ID2)
margins, dydx (treatment50)
quietly probit openfirst treatment90  i.Period , vce(cluster ID2)
margins, dydx (treatment90)






************* End of Do file ***************
